# 版本
cmake_minimum_required(VERSION 3.0)
# 项目名
project(CloudDisk)
# c++标准
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED on)


# 添加可执行文件 - 先定义 gateway 目标
add_executable(gateway 
"./Gateway/CloudDiskGateway.cc"
"./Gateway/main.cc"
"./srcCloudDisk/Logger.cc"
"./srcCloudDisk/ParseUtil.cc"
"./srcCloudDisk/CryptoUtil.cc"
"./srcCloudDisk/ParseUtil.cc"
"./srcCloudDisk/SignUp.pb.cc"
"./srcCloudDisk/SignIn.pb.cc"
"./srcCloudDisk/UserInfo.pb.cc"
"./srcCloudDisk/FilelistQuery.pb.cc"
"./srcCloudDisk/Upload.pb.cc"
"./srcCloudDisk/ConsulCenter.cc"
)

# 为 gateway 目标添加头文件搜索路径
target_include_directories(gateway PRIVATE ./include)

# 为 gateway 目标添加编译选项
target_compile_options(gateway PRIVATE 
-g  -fno-rtti -DBUG)

# 为 gateway 可执行文件单独设置输出路径（可选）
set_target_properties(gateway PROPERTIES
    RUNTIME_OUTPUT_DIRECTORY
    ../)

# 添加连接库
target_link_libraries(gateway PRIVATE 
wfrest alibabacloud-oss-cpp-sdk curl crypto pthread workflow ssl jwt log4cpp srpc SimpleAmqpClient lz4 snappy protobuf ppconsul)



# 添加可执行文件 - 再定义 signUpServer 目标
add_executable(signUpServer 
"./Service/SignUpServer.cc"
"./srcCloudDisk/CryptoUtil.cc"
"./srcCloudDisk/Logger.cc"
"./srcCloudDisk/SignUp.pb.cc"
)

# 为 signUpServer 目标添加头文件搜索路径
target_include_directories(signUpServer PRIVATE ./include)

# 为 signUpServer 目标添加编译选项
target_compile_options(signUpServer PRIVATE 
-g  -fno-rtti -DBUG)

# 为 signUpServer 可执行文件单独设置输出路径（可选）
set_target_properties(signUpServer PROPERTIES
    RUNTIME_OUTPUT_DIRECTORY
    ../)

# 添加连接库
target_link_libraries(signUpServer PRIVATE 
workflow log4cpp srpc lz4 snappy protobuf crypto ssl jwt ppconsul)



# 添加可执行文件 - 再定义 signInServer 目标
add_executable(signInServer 
"./Service/SignInServer.cc"
"./srcCloudDisk/CryptoUtil.cc"
"./srcCloudDisk/Logger.cc"
"./srcCloudDisk/SignIn.pb.cc"
)

# 为 signInServer 目标添加头文件搜索路径
target_include_directories(signInServer PRIVATE ./include)

# 为 signInServer 目标添加编译选项
target_compile_options(signInServer PRIVATE 
-g  -fno-rtti -DBUG)

# 为 signInServer 可执行文件单独设置输出路径（可选）
set_target_properties(signInServer PROPERTIES
    RUNTIME_OUTPUT_DIRECTORY
    ../)

# 添加连接库
target_link_libraries(signInServer PRIVATE 
workflow log4cpp srpc protobuf lz4 snappy crypto ssl jwt ppconsul)


# 添加可执行文件 - 再定义 userInfoServer 目标
add_executable(userInfoServer 
"./Service/UserInfoServer.cc"
"./srcCloudDisk/CryptoUtil.cc"
"./srcCloudDisk/Logger.cc"
"./srcCloudDisk/UserInfo.pb.cc"
)

# 为 userInfoServer 目标添加头文件搜索路径
target_include_directories(userInfoServer PRIVATE ./include)

# 为 userInfoServer 目标添加编译选项
target_compile_options(userInfoServer PRIVATE 
-g  -fno-rtti -DBUG)

# 为 userInfoServer 可执行文件单独设置输出路径（可选）
set_target_properties(userInfoServer PROPERTIES
    RUNTIME_OUTPUT_DIRECTORY
    ../)

# 添加连接库
target_link_libraries(userInfoServer PRIVATE 
workflow log4cpp srpc protobuf lz4 snappy crypto ssl jwt ppconsul)


# 添加可执行文件 - 再定义filelistQueryServer 目标
add_executable(filelistQueryServer 
"./Service/FilelistQueryServer.cc"
"./srcCloudDisk/CryptoUtil.cc"
"./srcCloudDisk/Logger.cc"
"./srcCloudDisk/FilelistQuery.pb.cc"
)

# 为 filelistQueryServer 目标添加头文件搜索路径
target_include_directories(filelistQueryServer PRIVATE ./include)

# 为filelistQueryServer 目标添加编译选项
target_compile_options(filelistQueryServer PRIVATE 
-g  -fno-rtti -DBUG)

# 为 filelistQueryServer 可执行文件单独设置输出路径（可选）
set_target_properties(filelistQueryServer PROPERTIES
    RUNTIME_OUTPUT_DIRECTORY
    ../)

# 添加连接库
target_link_libraries(filelistQueryServer PRIVATE 
workflow log4cpp srpc protobuf lz4 snappy crypto ssl jwt ppconsul)


# 添加可执行文件 - 再定义uploadServer 目标
add_executable(uploadServer 
"./Service/UploadServer.cc"
"./srcCloudDisk/CryptoUtil.cc"
"./srcCloudDisk/Logger.cc"
"./srcCloudDisk/Upload.pb.cc"
"./srcCloudDisk/MessageQueue.cc"
"./srcCloudDisk/OssManger.cc"
)

# 为 uploadServer 目标添加头文件搜索路径
target_include_directories(uploadServer PRIVATE ./include)

# 为uploadServer 目标添加编译选项
target_compile_options(uploadServer PRIVATE 
-g  -fno-rtti -DBUG)

# 为 uploadServer 可执行文件单独设置输出路径（可选）
set_target_properties(uploadServer PROPERTIES
    RUNTIME_OUTPUT_DIRECTORY
    ../)

# 添加连接库
target_link_libraries(uploadServer PRIVATE 
alibabacloud-oss-cpp-sdk curl crypto pthread workflow ssl jwt log4cpp srpc SimpleAmqpClient lz4 snappy protobuf ppconsul)


# 添加可执行文件 - 再定义 backup 目标
add_executable(backup 
"./MqBackup/backup.cc"
"./srcCloudDisk/MessageQueue.cc"
"./srcCloudDisk/Logger.cc"
"./srcCloudDisk/OssManger.cc"
)

# 为 backup 目标添加头文件搜索路径
target_include_directories(backup PRIVATE ./include)

# 为 backup 目标添加编译选项
target_compile_options(backup PRIVATE 
-g -Wall -fno-rtti -DBUG)

# 为 backup 可执行文件单独设置输出路径（可选）
set_target_properties(backup PROPERTIES
    RUNTIME_OUTPUT_DIRECTORY
    ../)

# 添加连接库
target_link_libraries(backup PRIVATE 
wfrest alibabacloud-oss-cpp-sdk curl crypto pthread workflow ssl jwt log4cpp SimpleAmqpClient lz4 snappy srpc protobuf ppconsul)
